home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / amc / amc_install.exe / {app} / Scripts / Animeka (FR).ifs < prev    next >
Encoding:
Text File  |  2005-03-12  |  27.9 KB  |  862 lines

  1. (***************************************************
  2.  
  3. Ant Movie Catalog importation script
  4. www.antp.be/software/moviecatalog/
  5.  
  6. [Infos]
  7. Authors=ScorEpioN
  8. Title=Animeka.com
  9. Description=Recherche d'Animes staff, synopsis, Θpisodes, et images
  10. Site=http://www.animeka.com
  11. Language=FR
  12. Version=22 du 07/03/2005
  13. Requires=3.5.0
  14. Comments=
  15. License=This program is free software; you can redistribute it and/or modify it under the  terms of the GNU General Public License as published by the Free Software Foundation;  either version 2 of the License, or (at your option) any later version. |
  16. GetInfo=1
  17.  
  18. [Options]
  19. Type de Lancement=0|0|0=Demande le titre avant de lancer le script|1=Ne demande pas le titre avant de lancer le script , met aucun resultat dans adresse web|2=idem et met rΘsutlats multiples
  20. Format du Titre=3|3|0=Titre en minuscule|1=Titre en majuscule|2=PremiΦre lettre du titre en majuscule|3=PremiΦre lettre de chaque mot du titre en majuscule
  21. Recherche sur le titre=0|0|0=Traduit|1=Original
  22.  
  23. ***************************************************)
  24.  
  25. program ANIMEKA_SEARCH;
  26.  
  27. var
  28.   MovieName, NomFilm, la_liste, premiere_pageEpisode, Reponse : string;
  29.   premiereExecution : Integer;
  30.  
  31. //------------------------------------------------------------------------------
  32. // VERIFIER LA VERSION DU SCRIPT
  33. //------------------------------------------------------------------------------
  34.  
  35. procedure verifVersion();
  36. var
  37.    Line, NewVersion : String;
  38.    BeginPos, EndPos : Integer;
  39. begin
  40.   Line := GetPage('http://forum.antp.be/phpbb2/viewtopic.php?t=1453');
  41.   BeginPos := pos('TELECHARGER LE SCRIPT ANIMEKA v', Line);
  42.   delete(Line,1, BeginPos+30);
  43.   EndPos := pos('du', Line);
  44.   NewVersion := copy(Line, 1, EndPos - 2);
  45.   if (ShowConfirmation('La derniΦre version est la '+NewVersion+'. Cliquer sur ''''OUI'''' pour la tΘlΘcharger.') = True) then
  46.   begin
  47.     Launch('iexplore.exe','http://www.ifrance.com/ricoland/Animeka%20(FR).ifs');
  48.   end else
  49.     exit;
  50. end;
  51.  
  52. //------------------------------------------------------------------------------
  53. // MET LE TITRE AU BON FORMAT
  54. //------------------------------------------------------------------------------
  55.  
  56. function formatTitre(titre : String; option : Integer) : string;
  57. begin
  58.   if (option = 0) then
  59.   begin
  60.      titre := AnsiLowerCase(titre);
  61.   end else if (option = 1) then
  62.   begin
  63.      titre := AnsiUpperCase(titre);
  64.   end else if (option = 2) then
  65.   begin
  66.      titre := AnsiUpFirstLetter(titre);
  67.   end else if (option = 3) then
  68.   begin
  69.      titre := AnsiMixedCase(titre,' -');
  70.   end;
  71.   result := titre;
  72. end;
  73.  
  74. //------------------------------------------------------------------------------
  75. // ANALYSE DE LA PAGE DE RECHERCHES
  76. //------------------------------------------------------------------------------
  77.  
  78. procedure AnalyzePage(Address: string);
  79. var
  80.   Page: TStringList;
  81.   LineNr: Integer;
  82.   Line,page_film,titre_film, realisateur_film, annee_film : string;
  83.   BeginPos, EndPos, compteur : Integer;
  84.   begin
  85. //vide la liste des films
  86.   PickTreeClear;
  87. //charge la page
  88.   Line := GetPage(Address);
  89.  
  90. //teste si il y a des films trouvΘs
  91.   BeginPos := Pos('Aucuns r', Line);
  92.   if BeginPos <> 0 then  
  93.   begin
  94.     if (GetOption('Type de Lancement') = 0) then
  95.     begin
  96.     titre_film := MovieName;
  97.     titre_film := StringReplace(titre_film, #13#10, '');
  98.     titre_film := StringReplace(titre_film, '   ', '');
  99.     titre_film := Trim(titre_film);
  100.     titre_film := AnsiLowerCase(titre_film);
  101.     titre_film := AnsiUpFirstLetter(titre_film);
  102.     showmessage('Aucun Anime trouvΘ pour : ' + titre_film);
  103.     exit;
  104.     end else
  105.     begin
  106.     SetField(fieldURL, 'Animeka : aucun rΘsultat');
  107.     exit;
  108.     end;
  109.   end;
  110.  
  111. //teste si on a ΘtΘ redirigΘ vers la fiche de l'anime
  112.   BeginPos := Pos('<script language="javascript">document.location.href=', Line);
  113.   if BeginPos <> 0 then
  114.   begin
  115.     Delete(Line, 1, BeginPos+53);
  116.     EndPos := Pos('</script>',Line);
  117.     page_film := 'http://www.animeka.com' + Copy(Line, 1, EndPos-2 );
  118.     if (Pos('fansub',page_film) = 0) then
  119.     begin
  120.       AnalysePageFilm(page_film);
  121.       exit;
  122.     end else
  123.     begin
  124.       AnalyzePageFansub(page_film);
  125.       exit;
  126.     end;
  127.   end;
  128.  
  129. //introduction rΘsultats  
  130.   titre_film := MovieName;
  131.   titre_film := StringReplace(titre_film, #13#10, '');
  132.   titre_film := StringReplace(titre_film, '   ', '');
  133.   titre_film := Trim(titre_film);
  134.   titre_film := AnsiLowerCase(titre_film);
  135.   titre_film := AnsiUpFirstLetter(titre_film);  
  136.   PickTreeAdd('Animes trouvΘs pour ' + titre_film + ' :', '');  
  137.  
  138. //compte les rΘsultats
  139.   compteur := 0;
  140.   
  141.   repeat
  142. //cherche le lien de la page du film
  143.   BeginPos := Pos('<a href="/animes/detail/',Line);
  144.   Delete(Line, 1, BeginPos+8);
  145.   EndPos := Pos('">',Line);
  146.   page_film := 'http://www.animeka.com' + Copy(Line, 1, EndPos-1 );
  147. //cherche le nom du film
  148.   BeginPos := Pos('">',Line);
  149.   Delete(Line, 1, BeginPos+1);
  150.   EndPos := Pos('</b></a>',Line)-1;
  151.   titre_film := Copy(Line, 1, EndPos );
  152.   HTMLdecode(titre_film);
  153.   HTMLremovetags(titre_film);
  154.   titre_film := StringReplace(titre_film, #13#10, '');
  155.   titre_film := StringReplace(titre_film, '   ', '');
  156.   titre_film := Trim(titre_film);
  157.   titre_film := AnsiLowerCase(titre_film);
  158.   titre_film := AnsiUpFirstLetter(titre_film);
  159. //ajoute les films
  160.     PickTreeAdd(titre_film , page_film);
  161.     compteur := compteur+1;
  162. //cherche le lien de la page du film
  163.     BeginPos := Pos('/animes/detail/',Line);
  164.   until BeginPos = 0;
  165.   PickTreeAdd(' ', '');
  166.   PickTreeAdd('Verifier si vous avez la derniΦre version', 'version');
  167.   PickTreeAdd('Pour me contacter', 'contact');
  168.  
  169.   if compteur = 1 then
  170.   begin
  171.     compteur := 0;
  172.     AnalysePageFilm(page_film);
  173.     exit;
  174.   end;
  175.  
  176.  
  177.   if (GetOption('Type de Lancement') = 0) or (GetOption('Type de Lancement') = 1) then
  178.   begin
  179.   begin
  180.     if PickTreeExec(Address)=true then
  181.     begin
  182.       if (Address = 'version') then
  183.       begin
  184.         verifVersion();
  185.       end else if (Address = 'contact') then
  186.       begin
  187.         Launch('iexplore.exe','http://forum.antp.be/phpbb2/viewtopic.php?t=1453');
  188.       end else
  189.       begin
  190.         AnalysePageFilm(Address);
  191.       end;
  192.     end;
  193.   end;
  194.   end else
  195.   begin
  196.     SetField(fieldURL, 'Animeka : rΘsultats multiples');
  197.     exit;
  198.   end;
  199.  
  200. end;
  201.  
  202. //------------------------------------------------------------------------------
  203. // ANALYSE DE LA PAGE FANSUB
  204. //------------------------------------------------------------------------------
  205.  
  206. procedure AnalyzePageFansub(Address: string);
  207. var
  208.   Line ,page_film : string;
  209.   BeginPos, EndPos : Integer;
  210. begin
  211.   Line := GetPage(Address);
  212.   BeginPos := Pos('"animestitle"', Line);
  213.   Delete(Line, 1, BeginPos);
  214.   BeginPos := Pos('a href="', Line);
  215.   Delete(Line, 1, BeginPos+7);
  216.   EndPos := Pos('">',Line);
  217.   page_film := 'http://www.animeka.com' + Copy(Line, 1, EndPos-1 );
  218.   AnalysePageFilm(page_film);
  219. end;
  220.  
  221. //------------------------------------------------------------------------------
  222. // ANALYSE DE LA PAGE DU FILM
  223. //------------------------------------------------------------------------------
  224.  
  225. procedure AnalysePageFilm(Address: string);
  226. var
  227.   Line,page_film,titre_film,titre_original, categorie_film, realisateur_film, studio_film, annee_film: string;
  228.   critique, noteRedaction, pays_film, url_film, duree_film, episode_anime, page_episodes, liste_episodes, acteurs_film, liste_acteurs, description_film, reference_film,public_film,video_film,audio_film,fichier_image,aucun:string;
  229.   BeginPos, EndPos, i: Integer;
  230. begin
  231. //pause pour eviter les time out
  232.   sleep(1500);
  233. //charge la page
  234.   Line := GetPage(Address);
  235.   url_film := Address;
  236.  
  237. //cherche le nom du film
  238.   BeginPos := Pos('"animestitle"', Line);
  239.   Delete(Line, 1, BeginPos+39);
  240.   EndPos := Pos('</td>',Line);
  241.   titre_film := Copy(Line, 1, EndPos-1 );
  242.   HTMLdecode(titre_film);
  243.   HTMLremovetags(titre_film);
  244.   titre_film := StringReplace(titre_film, #13#10, '');
  245.   titre_film := StringReplace(titre_film, '   ', '');
  246.   titre_film := Trim(titre_film);
  247.   titre_film := AnsiLowerCase(titre_film);
  248.   titre_film := AnsiMixedCase(titre_film, ' -');
  249.   titre_film := nettoieTitre(titre_film);
  250.  
  251. //chargement des jaquettes
  252.   BeginPos := Pos('<img class="picture" src=', Line);
  253.   if BeginPos <> 0 then
  254.     begin
  255.       Delete(Line, 1, BeginPos+26);
  256.       EndPos := Pos(' width',Line);
  257.       fichier_image := 'http://www.animeka.com/' + Copy(Line, 1, EndPos-2 );
  258. //pour eviter les time-out      
  259.       sleep(1500);
  260.       GetPicture(fichier_image);
  261.     end;
  262.  
  263.  //cherche le titre original
  264.    BeginPos := Pos('<td class="animestxt">  ', Line);
  265.    Delete(Line, 1, BeginPos+50);
  266.    EndPos := Pos('</td>',Line);
  267.    titre_original := Copy(Line, 1, EndPos-1 );
  268.    HTMLdecode(titre_original);
  269.    HTMLremovetags(titre_original);
  270.    titre_original := StringReplace(titre_original, #13#10, '');
  271.    titre_original := StringReplace(titre_original, '   ', '');
  272.    titre_original := Trim(titre_original);
  273.    titre_original := AnsiLowerCase(titre_original);
  274.    titre_original := AnsiMixedCase(titre_original, ' ');
  275.    titre_original := AnsiMixedCase(titre_original, '-');
  276.  
  277. //cherche l'annΘe
  278.   BeginPos := Pos('<tr><td class="animestxt">  ', Line);
  279.   Delete(Line, 1, BeginPos+66);
  280.   EndPos := Pos('</td>',Line);
  281.   annee_film := Copy(Line, 1, EndPos-1 );
  282.   duree_film := '';
  283.   i:=pos('-',annee_film);
  284.   if i <> 0 then
  285.   begin
  286.     duree_film := #13#10#13#10 + 'ANN╔ES DE PRODUCTION : ' + annee_film;
  287.     annee_film := copy(annee_film,1,i-1);
  288.     annee_film := Trim(annee_film);
  289.   end;
  290.  
  291. //cherche le studio
  292.   BeginPos := Pos('STUDIO', Line);
  293.   Delete(Line, 1, BeginPos+8);
  294.   EndPos := Pos('</td></tr>',Line);
  295.   studio_film := Copy(Line, 1, EndPos-1 );
  296.   HTMLRemoveTags(studio_film);
  297.   HTMLdecode(studio_film);
  298.   studio_film := StringReplace(studio_film, #13#10, '');
  299.   studio_film := StringReplace(studio_film, '   ', '');
  300.   studio_film := StringReplace(studio_film, '] [', ' - ');
  301.   studio_film := StringReplace(studio_film, '[', '');
  302.   studio_film := StringReplace(studio_film, ']', '');
  303.   studio_film := Trim(studio_film);
  304.   studio_film := AnsiLowerCase(studio_film);
  305.   studio_film := AnsiMixedCase(studio_film, ' -');
  306.  
  307. //cherche la catΘgorie
  308.   BeginPos := Pos('GENRE', Line);
  309.   Delete(Line, 1, BeginPos+8);
  310.   EndPos := Pos('</td></tr>',Line);
  311.   categorie_film := Copy(Line, 1, EndPos-1);
  312.   HTMLRemoveTags(categorie_film);
  313.   HTMLdecode(categorie_film);
  314.   categorie_film := StringReplace(categorie_film, #13#10, '');
  315.   categorie_film := StringReplace(categorie_film, '   ', '');
  316.   categorie_film := StringReplace(categorie_film, '] [', ' - ');
  317.   categorie_film := StringReplace(categorie_film, '[', '');
  318.   categorie_film := StringReplace(categorie_film, ']', '');
  319.   categorie_film := Trim(categorie_film);
  320.   categorie_film := AnsiLowerCase(categorie_film);
  321.   categorie_film := AnsiMixedCase(categorie_film, ' -');
  322.  
  323. //cherche le rΘalisateur
  324.   BeginPos := Pos('AUTEUR : ', Line);
  325.   Delete(Line, 1, (BeginPos-1));
  326.   aucun := Copy(Line, 10, 3 );
  327.   if aucun = 'Non' then
  328.   begin
  329.     realisateur_film := 'Non SpΘcifiΘ';
  330.     end else
  331.   begin
  332.   BeginPos := Pos('.html">', Line);
  333.   Delete(Line, 1, BeginPos+6);
  334.   EndPos := Pos('</a>',Line);
  335.   realisateur_film := Copy(Line, 1, EndPos-1 );
  336.   HTMLdecode(realisateur_film);
  337.   realisateur_film := StringReplace(realisateur_film, #13#10, '');
  338.   realisateur_film := StringReplace(realisateur_film, '   ', '');
  339.   realisateur_film := Trim(realisateur_film);
  340.   realisateur_film := AnsiLowerCase(realisateur_film);
  341.   realisateur_film := AnsiMixedCase(realisateur_film, ' ');
  342.   realisateur_film := AnsiMixedCase(realisateur_film, '-');
  343.   end;
  344.  
  345. //cherche la durΘe
  346.   BeginPos := Pos('DUR', Line);
  347.   Delete(Line, 1, BeginPos-1);
  348.   EndPos := Pos('</td></tr>',Line);
  349.   duree_film := Copy(Line, 1, EndPos-1 ) + duree_film;
  350.   HTMLdecode(duree_film);
  351.   duree_film := StringReplace(duree_film, '   ', '');
  352.   duree_film := Trim(duree_film);
  353. // durΘe dans le champs durΘe
  354.   aucun := duree_film;
  355.   BeginPos := Pos('mins',aucun);
  356.   delete(aucun,1,BeginPos-6);
  357.   BeginPos := Pos(' ',aucun);
  358.   EndPos := Pos(' mins',aucun);
  359.   aucun := copy(aucun,BeginPos+1,EndPos-BeginPos-1);
  360.   aucun := Trim(aucun);
  361.   if aucun <> '' then
  362.     if CanSetField(fieldLength) then
  363.       SetField(fieldLength,aucun);
  364.  
  365. //cherche le pays
  366.   BeginPos := Pos('show_flag.php', Line);
  367.   Delete(Line, 1, BeginPos);
  368.   BeginPos := Pos('alt=', Line);
  369.   Delete(Line, 1, BeginPos+4);
  370.   EndPos := Pos('"',Line);
  371.   pays_film := Copy(Line, 1, EndPos-1 );
  372.   HTMLdecode(pays_film);
  373.   pays_film := StringReplace(pays_film, #13#10, '');
  374.   pays_film := StringReplace(pays_film, '   ', '');
  375.   pays_film := Trim(pays_film);
  376.   HTMLremovetags(pays_film);
  377.   pays_film := AnsiLowerCase(pays_film);
  378.   pays_film := AnsiMixedCase(pays_film, ' ');
  379.   pays_film := AnsiMixedCase(pays_film, '-');
  380.  
  381. //cherche la description
  382.   BeginPos := Pos('Synopsis', Line);
  383.   Delete(Line, 1, BeginPos+126);
  384.   aucun := Copy(Line, 10, 3 );
  385.   if aucun = 'sp;' then
  386.   begin
  387.     aucun := 'Pas de description pour le moment';
  388.   end else
  389.   begin
  390.   EndPos := Pos('</td></tr></table></td></tr>',Line)-1;
  391.   description_film := Copy(Line, 1, EndPos );
  392.   HTMLdecode(description_film);
  393.   description_film := StringReplace(description_film, #13#10, '');
  394.   description_film := StringReplace(description_film, '<br />',#13#10);
  395.   description_film := StringReplace(description_film, '<b>', '');
  396.   description_film := StringReplace(description_film, '</b>', '');
  397.   description_film := StringReplace(description_film, '<i>', '');
  398.   description_film := StringReplace(description_film, '</i>', '');
  399.   description_film := StringReplace(description_film, '   ', ' '); 
  400.   description_film := StringReplace(description_film, '</div>', ' '); 
  401.   description_film := StringReplace(description_film, '<div class="u">', '');
  402.   description_film := deleteBalise(description_film);
  403.   end;
  404.   
  405. //cherche les critiques
  406.   BeginPos := Pos('Critiques', Line);
  407.   Delete(Line, 1, BeginPos);
  408.   if BeginPos = 0 then
  409.   begin
  410.     critique := 'Pas de critiques pour le moment';
  411.   end else
  412.   begin
  413.     BeginPos := Pos('<td class="animestxt">', Line);
  414.     Delete(Line, 1, BeginPos+21);
  415.     EndPos := Pos('</td></tr></table></td></tr>',Line);
  416.     critique := 'Critiques : ';
  417.     critique := critique + Copy(Line, 1, EndPos-1 );
  418.     HTMLdecode(critique);
  419.     critique := StringReplace(critique, #13#10, ' ');
  420.     critique := StringReplace(critique, '<br />', ' ');
  421.     critique := StringReplace(critique, '<b>', '');
  422.     critique := StringReplace(critique, '</b>', '');
  423.     critique := StringReplace(critique, '<i>', '');
  424.     critique := StringReplace(critique, '</i>', '');
  425.     critique := StringReplace(critique, '   ', ' ');
  426.     critique := deleteBalise(critique);
  427.     description_film := description_film + #13#10#13#10 + critique;
  428.   end;
  429.   
  430. //cherche la note de la rΘdaction
  431.   BeginPos := Pos('Note de la rΘdaction', Line);
  432.   Delete(Line, 1, BeginPos);
  433.   if BeginPos = 0 then
  434.   begin
  435.     noteRedaction := 'Pas de note de la rΘdaction pour le moment';
  436.   end else
  437.   begin
  438.     BeginPos := Pos('<td class="animestxt">', Line);
  439.     Delete(Line, 1, BeginPos+21);
  440.     EndPos := Pos('</td></tr></table></td></tr>',Line);
  441.     noteRedaction := 'Note de la rΘdaction : ';
  442.     noteRedaction := noteRedaction + Copy(Line, 1, EndPos-1 );
  443.     HTMLdecode(noteRedaction);
  444.     noteRedaction := StringReplace(noteRedaction, #13#10, ' ');
  445.     noteRedaction := StringReplace(noteRedaction, '<br />', ' ');
  446.     noteRedaction := StringReplace(noteRedaction, '<b>', '');
  447.     noteRedaction := StringReplace(noteRedaction, '</b>', '');
  448.     noteRedaction := StringReplace(noteRedaction, '<i>', '');
  449.     noteRedaction := StringReplace(noteRedaction, '</i>', '');
  450.     noteRedaction := StringReplace(noteRedaction, '   ', ' ');
  451.     noteRedaction := deleteBalise(noteRedaction);
  452.     description_film := description_film + #13#10#13#10 + noteRedaction;
  453.   end;
  454.   
  455. //cherche les Θpisodes 
  456.   BeginPos := Pos('/animes/epis/', Line);
  457.   Delete(Line, 1, BeginPos-1);
  458.   if BeginPos = 0 then
  459.   begin
  460.     aucun := 'Pas de listing d''Θpisodes pour le moment';
  461.   end else
  462.   begin
  463.     EndPos := Pos('" class',Line);
  464.     page_episodes := 'http://www.animeka.com'+Copy(Line, 1, EndPos-1 );
  465.     premiere_pageEpisode := page_episodes;
  466.     liste_episodes := 'Liste des Θpisodes'+#13#10#13#10;
  467.     la_liste := '';
  468.     TrouveEpisode(page_episodes);
  469.     liste_episodes := liste_episodes + la_liste;
  470.   end;
  471.  
  472. //charge les rΘsultats dans la fenΩtre
  473.   if CanSetField(fieldTranslatedTitle) then
  474.     SetField( fieldTranslatedTitle,formatTitre(titre_film,GetOption('Format du Titre')));
  475.     if CanSetField(fieldOriginalTitle) then
  476.     SetField( fieldOriginalTitle,formatTitre(titre_original,GetOption('Format du Titre')));
  477.   if titre_original = '' then
  478.   begin
  479.     if CanSetField(fieldOriginalTitle) then
  480.       SetField( fieldOriginalTitle,formatTitre(titre_film,GetOption('Format du Titre')));
  481.   end;
  482.   if CanSetField(fieldURL) then
  483.     SetField( fieldURL,url_film);
  484.   if CanSetField(fieldCategory) then
  485.     SetField( fieldCategory,categorie_film);
  486.   if CanSetField(fieldDirector) then
  487.     SetField( fieldDirector,realisateur_film);
  488.   if CanSetField(fieldYear) then
  489.     SetField( fieldYear,annee_film);
  490.   if CanSetField(fieldCountry) then
  491.     SetField( fieldCountry,pays_film);
  492.   if CanSetField(fieldActors) then
  493.     SetField( fieldActors,duree_film);
  494.   if CanSetField(fieldDescription) then
  495.     SetField( fieldDescription,description_film);
  496.   if CanSetField(fieldProducer) then
  497.     SetField( fieldProducer,studio_film);
  498.   if CanSetField(fieldComments) then
  499.     SetField( fieldComments,liste_episodes);
  500.   //DisplayResults;
  501. end;
  502.  
  503. //------------------------------------------------------------------------------
  504. // ANALYSE DE LA PAGE DES EPISODES
  505. //------------------------------------------------------------------------------
  506.  
  507. procedure TrouveEpisode(page_episodes: string);
  508. var
  509.   Line, episode_anime, liste_episodes, aucun, resume, titre_episode:string;
  510.   BeginPos, EndPos, i: Integer;
  511. begin
  512. //pour eviter les time-out
  513.   sleep(1500);
  514. //charge la page
  515.   Line := GetPage(page_episodes);
  516. //compteur
  517.   i := 0;
  518. //liste les Θpisodes
  519.   repeat
  520.   i := i+1;
  521.   BeginPos := Pos('<td class="animestitle" style="padding-left:5px" >', Line);
  522.   Delete(Line, 1, BeginPos+49);
  523.   EndPos := Pos('</td></tr>',Line);
  524.   aucun := Copy(Line, 1, 1 );
  525. //pour n'avoir que les Θpisodes
  526.   if aucun = '<' then
  527.   begin
  528.     exit;
  529.   end else
  530.   begin
  531. //NumΘro et titre Θpisode
  532.     titre_episode := Copy(Line, 1, EndPos-1 );
  533.     titre_episode := deleteKanji(titre_episode);
  534.     titre_episode := StringReplace(titre_episode, #13#10,'');
  535.     la_liste := la_liste + titre_episode + #13#10;
  536. //Pour le rΘsumΘ    
  537.     BeginPos := Pos('<table cellspacing="5"  width="100%"><tr><td class="animestxt">', Line);
  538.     Delete(Line, 1, BeginPos+62);
  539.     EndPos := Pos('</td></tr></table>',Line);
  540.     resume := Copy(Line, 1, EndPos-1 );
  541.     resume := StringReplace(resume, '<br />',' ');
  542.     resume := StringReplace(resume, '’','''');
  543.     resume := StringReplace(resume, #13#10,' ');
  544.     if resume <> '' then
  545.     begin
  546.       la_liste := la_liste + resume + #13#10#13#10;
  547.     end;
  548.   end;
  549.   until i = 25;
  550.  
  551. //Si 25 Θpisodes et + alors page suivante
  552.   if i = 25 then
  553.   begin
  554.     BeginPos := Pos('<td class="animestitle" style="padding-left:5px" >', Line);
  555.     Delete(Line, 1, BeginPos+49);
  556.     EndPos := Pos('</td></tr>',Line);
  557.     aucun := Copy(Line, 1, 1 );
  558. //Si il y a juste 25 Θpisodes
  559.   if aucun = '<' then
  560.   begin
  561.     exit;  
  562.   end else
  563.   begin    
  564. //NumΘro et titre Θpisode
  565.     titre_episode := Copy(Line, 1, EndPos-1 );
  566.     titre_episode := deleteKanji(titre_episode);
  567.     la_liste := la_liste + titre_episode + #13#10;
  568. //Pour le rΘsumΘ    
  569.     BeginPos := Pos('<table cellspacing="5"  width="100%"><tr><td class="animestxt">', Line);
  570.     Delete(Line, 1, BeginPos+62);
  571.     EndPos := Pos('</td></tr></table>',Line);
  572.     resume := Copy(Line, 1, EndPos-1 );
  573.     resume := StringReplace(resume, '<br />',' ');    
  574.     resume := StringReplace(resume, #13#10,' ');
  575.     if resume <> '' then
  576.     begin
  577.       la_liste := la_liste + resume + #13#10#13#10;
  578.     end;   
  579. //cherche la page suivante
  580.     BeginPos := Pos('PrΘcΘdent', Line);
  581.     Delete(Line, 1, BeginPos+9);
  582.     BeginPos := Pos('/animes/epis/', Line);
  583.     if BeginPos <> 0 then
  584.     begin
  585.       Delete(Line, 1, BeginPos-1);
  586.       EndPos := Pos('">',Line);
  587.       page_episodes := 'http://www.animeka.com'+Copy(Line, 1, EndPos-1 );
  588.       if page_episodes <> premiere_pageEpisode then
  589.       begin
  590.         TrouveEpisode(page_episodes);
  591.       end;
  592.     end;
  593.   end;
  594.   end;
  595. end;
  596.  
  597. //------------------------------------------------------------------------------
  598. // SUPPRESSION DES BALISES
  599. //------------------------------------------------------------------------------
  600.  
  601. function deleteBalise (la_ligne : String) : string;
  602. var
  603.   i,j, fin : Integer;
  604.   la_chaine_sans_balise, aucun : String;
  605. begin
  606.   la_chaine_sans_balise := '';
  607.   fin := Length(la_ligne);
  608.   repeat
  609.   i := pos('<',la_ligne);
  610.   if i <> 0 then
  611.   begin
  612.     aucun := copy(la_ligne,i+1,fin);
  613.     delete(aucun,2,fin);
  614. //pour Ωtre s√r d'avoir affaire α une balise
  615.     if aucun = ' ' then
  616.     begin
  617.       la_chaine_sans_balise := la_chaine_sans_balise + copy (la_ligne,1,i);
  618.       delete(la_ligne,1,i);
  619.     end else
  620.     begin
  621.       j := pos('>',la_ligne);
  622.       fin := Length(la_ligne);
  623.       la_chaine_sans_balise := la_chaine_sans_balise + copy (la_ligne,1,i-1);
  624.       delete(la_ligne,1,j);
  625.     end;
  626.   end;
  627.   until i = 0;
  628.   fin := Length(la_ligne);
  629.   la_chaine_sans_balise := la_chaine_sans_balise + copy (la_ligne,1,fin);
  630.   result := la_chaine_sans_balise;
  631. end;
  632.  
  633. //------------------------------------------------------------------------------
  634. // SUPPRESSION DES CARACTERES JAPONAIS DANS LES NOMS D'EPISODES
  635. //------------------------------------------------------------------------------
  636.  
  637. function deleteKanji (la_ligne : String) : string;
  638. var
  639.   i : Integer;
  640. begin
  641.   i:=pos('&#',la_ligne); // ces symboles caractΘrisent un caractΦre asiatique
  642.   if i <> 0 then
  643.   begin
  644.     la_ligne := copy(la_ligne,1,i-2);
  645.   end;
  646.   result := la_ligne;
  647. end;
  648.  
  649. //------------------------------------------------------------------------------
  650. // NETTOIE TITRE
  651. //------------------------------------------------------------------------------
  652.  
  653. function nettoieTitre(le_titre : String) : string;
  654. var
  655.   i : Integer;
  656. begin
  657.   i:=pos('(1',le_titre);
  658.   if i <> 0 then
  659.   begin
  660.     le_titre := copy(le_titre,1,i-1);
  661.     le_titre := Trim(le_titre);
  662.     result := le_titre;
  663.   end;
  664.   i:= 0;
  665.   i:=pos('(2',le_titre);
  666.   if i <> 0 then
  667.   begin
  668.     le_titre := copy(le_titre,1,i-1);
  669.     le_titre := Trim(le_titre);
  670.     result := le_titre;
  671.   end else
  672.     result := le_titre;
  673. end;
  674.  
  675. //------------------------------------------------------------------------------
  676. // NETTOIE LE TITRE DU FICHIER POUR AVOIR LE TITRE DE FILM
  677. //------------------------------------------------------------------------------
  678.  
  679. function cleanTitle(title : String) : string;
  680. var
  681.   i,j, fin : Integer;
  682.   temp : String;
  683.  
  684. begin
  685.   title := AnsiUpperCase(title);
  686.  
  687.   if title <> '' then
  688.   begin
  689. // Nettoie les tags fichiers, merci Atmosfear pour les tags
  690.   i:=pos('.DVD',title);
  691.   if i <> 0 then
  692.   begin
  693.     title := copy(title,1,i-1);
  694.   end;
  695.   i:=pos('.DIVX',title);
  696.   if i <> 0 then
  697.   begin
  698.     title := copy(title,1,i-1);
  699.   end;
  700.   i:=pos('.FREN',title);
  701.   if i <> 0 then
  702.   begin
  703.     title := copy(title,1,i-1);
  704.   end;
  705.   i:=pos('.GERM',title);
  706.   if i <> 0 then
  707.   begin
  708.     title := copy(title,1,i-1);
  709.   end;
  710.   i:=pos('.INT',title);
  711.   if i <> 0 then
  712.   begin
  713.     title := copy(title,1,i-1);
  714.   end;
  715.   i:=pos('.LIM',title);
  716.   if i <> 0 then
  717.   begin
  718.     title := copy(title,1,i-1);
  719.   end;
  720.   i:=pos('.PROP',title);
  721.   if i <> 0 then
  722.   begin
  723.     title := copy(title,1,i-1);
  724.   end;
  725.   i:=pos('.REPACK',title);
  726.   if i <> 0 then
  727.   begin
  728.     title := copy(title,1,i-1);
  729.   end;
  730.   i:=pos('.SUBB',title);
  731.   if i <> 0 then
  732.   begin
  733.     title := copy(title,1,i-1);
  734.   end;
  735.   i:=pos('.UNSUB',title);
  736.   if i <> 0 then
  737.   begin
  738.     title := copy(title,1,i-1);
  739.   end;
  740.   i:=pos('.WS',title);
  741.   if i <> 0 then
  742.   begin
  743.     title := copy(title,1,i-1);
  744.   end;
  745.   i:=pos('.XVID',title);
  746.   if i <> 0 then
  747.   begin
  748.     title := copy(title,1,i-1);
  749.   end;
  750.   i:=pos('.AC3',title);
  751.   if i <> 0 then
  752.   begin
  753.     title := copy(title,1,i-1);
  754.   end;
  755.   i:=pos('.UNRAT',title);
  756.   if i <> 0 then
  757.   begin
  758.     title := copy(title,1,i-1);
  759.   end;
  760.  
  761.    title := StringReplace(title, '.', ' ');
  762.    title := StringReplace(title, ',', ' ');
  763.    title := StringReplace(title, ':', '');
  764.    title := StringReplace(title, '-', '');
  765.    title := StringReplace(title, '  ', ' ');
  766.  
  767.    i := 0;
  768. // Nettoie les tags de team
  769.    if (pos('(',title) <> 0) then
  770.    begin
  771.      i := pos('(',title);
  772.      temp := copy(title,0,i-1);
  773.      j := pos(')',title);
  774.      fin := Length(title);
  775.      title := temp + copy(title,j+1,fin);
  776.    end;
  777.  
  778.    if (pos('[',title) <> 0) then
  779.    begin
  780.      i := pos('[',title);
  781.      temp := copy(title,1,i-1);
  782.      j := pos(']',title);
  783.      fin := Length(title);
  784.      title := temp + copy(title,j+1,fin);
  785.    end;
  786.  
  787.    title := AnsiLowerCase(title);
  788.    title := AnsiUpFirstLetter(title);
  789.    title := AnsiMixedCase(title,' -');
  790.   end;
  791.    result := title;
  792. end;
  793.  
  794. //------------------------------------------------------------------------------
  795. // PROGRAMME PRINCIPAL
  796. //------------------------------------------------------------------------------
  797.  
  798. begin
  799.   if CheckVersion(3,5,0) then
  800.   begin
  801.     if (GetOption('Recherche sur le titre') = 0) then
  802.     begin
  803.       NomFilm := GetField(fieldTranslatedTitle);
  804.       if NomFilm = '' then
  805.         NomFilm := GetField(fieldOriginalTitle);
  806.     end else
  807.     if (GetOption('Recherche sur le titre') = 1) then
  808.     begin
  809.       NomFilm := GetField(fieldOriginalTitle);
  810.       if NomFilm = '' then
  811.         NomFilm := GetField(fieldTranslatedTitle);
  812.     end;
  813.     NomFilm := cleanTitle(NomFilm);
  814.     if (GetOption('Type de Lancement') = 0) then
  815.     begin
  816.     if Input('Animeka avec Image by ScorEpioN', 'Entrez le titre de l''anime :', NomFilm) then
  817.     begin
  818.       if Pos('animeka.com', NomFilm) > 0 then
  819.         begin
  820.           AnalysePageFilm(NomFilm);
  821.       end else
  822.       begin
  823.       //remplace les caractΦres accentuΘs
  824.       MovieName := NomFilm;
  825.       NomFilm := AnsiLowerCase(NomFilm);
  826.       NomFilm := StringReplace(NomFilm, 'Θ', 'e');
  827.       NomFilm := StringReplace(NomFilm, 'Φ', 'e');
  828.       NomFilm := StringReplace(NomFilm, 'α', 'a');
  829.       NomFilm := StringReplace(NomFilm, 'τ', 'c');
  830.       NomFilm := StringReplace(NomFilm, '∙', 'u');
  831.       NomFilm := StringReplace(NomFilm, ' ', '+');
  832.       NomFilm := 'http://www.animeka.com/search/index.html?req='+ UrlEncode(NomFilm)+'&zone_series=1&go_search=1&cat=search';
  833.       AnalyzePage(NomFilm);
  834.       end;
  835.     end;
  836.     end else
  837.     begin
  838.       MovieName := NomFilm;
  839.       NomFilm := AnsiLowerCase(NomFilm);
  840.       NomFilm := StringReplace(NomFilm, 'Θ', 'e');
  841.       NomFilm := StringReplace(NomFilm, 'Φ', 'e');
  842.       NomFilm := StringReplace(NomFilm, 'α', 'a');
  843.       NomFilm := StringReplace(NomFilm, 'τ', 'c');
  844.       NomFilm := StringReplace(NomFilm, '∙', 'u');
  845.       NomFilm := StringReplace(NomFilm, ' ', '+');
  846.       if (premiereExecution = 0) then
  847.       begin
  848.           premiereExecution := -1;
  849.           if (ShowConfirmation('Vous allez executer le script sans confirmation, cliquer sur ''''OUI'''' pour continuer') = True) then
  850.           begin
  851.             AnalyzePage('http://www.animeka.com/search/index.html?req='+ UrlEncode(NomFilm)+'&zone_series=1&go_search=1&cat=search');
  852.           end else
  853.             exit;
  854.       end else
  855.       begin
  856.         AnalyzePage('http://www.animeka.com/search/index.html?req='+ UrlEncode(NomFilm)+'&zone_series=1&go_search=1&cat=search');
  857.       end;
  858.     end;
  859.   end else
  860.     ShowMessage('Ce script requiert une version plus rΘcente de Ant Movie Catalog (au moins la version 3.5.0)');
  861. end.
  862.